package com.example.demo.component;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;

import javax.servlet.http.HttpServletRequest;
import java.util.Collection;

@Component("authorityComponent")
public class AuthorityComponent {
    private AntPathMatcher antPathMatcher = new AntPathMatcher();
    public boolean hasPermission(HttpServletRequest request, Authentication authentication){
        boolean hasPermission = false;
        Object principal = authentication.getPrincipal();
        if(principal instanceof UserDetails){
            String url = request.getRequestURI();
            Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
        }
    return true;
    }
}
